package com.laowang.project.system.mapper;

import java.util.List;

import com.laowang.project.system.domain.MyCarBook;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 车友通讯录Mapper接口
 *
 * @author laowang
 * @date 2023-04-20
 */
public interface MyCarBookMapper {
    /**
     * 查询车友通讯录
     *
     * @param id 车友通讯录ID
     * @return 车友通讯录
     */
     MyCarBook selectMyCarBookById(Integer id);

    /**
     * 查询车友通讯录列表
     *
     * @param myCarBook 车友通讯录
     * @return 车友通讯录集合
     */
     List<MyCarBook> selectMyCarBookList(MyCarBook myCarBook);

    /**
     * 新增车友通讯录
     *
     * @param myCarBook 车友通讯录
     * @return 结果
     */
    int insertMyCarBook(MyCarBook myCarBook);

    /**
     * 修改车友通讯录
     *
     * @param myCarBook 车友通讯录
     * @return 结果
     */
    int updateMyCarBook(MyCarBook myCarBook);

    /**
     * 删除车友通讯录
     *
     * @param id 车友通讯录ID
     * @return 结果
     */
    int deleteMyCarBookById(Integer id);

    /**
     * 批量删除车友通讯录
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    int deleteMyCarBookByIds(Integer[] ids);

    @Select("select * from my_car_book where user_id =#{mid}")
    MyCarBook selectMyCarBookByUserId(Integer mid);

    @Select("select * from my_car_book where sub_card =#{fupai}")
    MyCarBook selectByFupai(String fupai);


    List<MyCarBook> selectMyCarBookListWeb(MyCarBook myCarBook);

    @Select("select * from my_car_book where sub_card =#{subCard} and car =#{car}")
    MyCarBook selectByFupaiAndCar(@Param("subCard") String subCard,@Param("car") String car);

    @Select("select * from my_car_book where sub_card =#{subCard} and user_id =#{userId}")
    MyCarBook selectByFupaiAndUserId(@Param("subCard") String subCard,@Param("userId") Integer userId);

    @Select("SELECT * FROM my_car_book WHERE `group` <> ''")
    List<MyCarBook> selectNotNull();
}
